
package com.itheima.loop;
import java.util.Scanner;
public class Cal {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个整数");
        int a = sc.nextInt();
        System.out.println("请输入第二个整数");
        int b = sc.nextInt();
        while(true) {
            System.out.println("请请输入你要进行的运算");
            int c = sc.nextInt();

                if (c >= 1 && c <= 4) {
                    switch (c) {
                        case 1:
                            System.out.println(a + " + " + b + " = " + (a + b));
                            break ;//就近原则 不能跳出死循环
                        case 2:
                            System.out.println(a + " - " + b + " = " + (a - b));
                            break;
                        case 3:
                            System.out.println(a + " * " + b + " = " + (a * b));
                            break;
                        case 4:
                            System.out.println(a + " / " + b + " = " + (a / b));
                            break;

                    }
                    break ;//1.结束循环 2在while前取标号 在break后写标号
                } else {
                    System.out.println("你输入的数据有误,请再输一次");
                }


        }
    }
}
